﻿using Microsoft.Crm.Sdk;

namespace TTprotons.Crm.JavascriptAudit.Common
{
    public class ContextHelper
    {
        private readonly IPluginExecutionContext _context;

        public ContextHelper(IPluginExecutionContext context)
        {
            _context = context;
        }

        private ICrmService _crmService;
        public ICrmService CrmService
        {
            get { return _crmService ?? (_crmService = _context.CreateCrmService(true)); }
        }

        private IMetadataService _metadataService;
        public IMetadataService MetadataService
        {
            get { return _metadataService ?? (_metadataService = _context.CreateMetadataService(true)); }
        }
    }
}